package Traductor.sintactico.utils;

import java.util.ArrayList;

public class Pendientes {
	private ArrayList<ClaveTS> pend;

	public Pendientes() {
		super();
		pend = new ArrayList<ClaveTS>();
	}

	public ArrayList<ClaveTS> getPend() {
		return pend;
	}

	public void setPend(ArrayList<ClaveTS> pend) {
		this.pend = pend;
	}
	
	public void anyadeId(String id, int n){
		ClaveTS c = new ClaveTS(id,n);
		this.pend.add(c);
	}
	public void eliminaId(String id, int n){
		int pos = this.pend.indexOf(new ClaveTS(id,n));
		if(!(pos==-1))
			this.pend.remove(pos);
	}

	public boolean existeID(String id, int nivel) {
		ClaveTS c = new ClaveTS(id,nivel);
		if(this.pend.contains(c))
			return true;
		return false;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((pend == null) ? 0 : pend.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Pendientes other = (Pendientes) obj;
		if (pend == null) {
			if (other.pend != null)
				return false;
		} else if (!pend.equals(other.pend))
			return false;
		return true;
	}

}
